package org.learn.spring5;

import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestSpring5 {
    @Test
    public void test() {
        //1.加载spring的配置文件
        BeanFactory context = new ClassPathXmlApplicationContext("bean1.xml");
        //2.获取配置创建的对象
            //第一个参数是配置文件中配置的User对象的ID
        User user = context.getBean("user",User.class);
        System.out.println(user);
        user.add();
    }
}
